#[derive(Debug)]
struct Foo(i32);
#[derive(Debug)]
struct Bar(i32,i32);

trait Inst{
    fn new(i:i32)->Self;
}

impl Inst for Foo{
    fn new(i:i32)->Foo{
        Foo(i)
    }
}

impl Inst for Bar{
    fn new(x:i32)->Bar{
        Bar(x,x+10)
    }
}

fn fooBar<T:Inst>(i:i32)->T{
    T::new(i)
}



fn main(){
 let f:Foo=fooBar(30);
 println!("{:?},",f);
let b:Bar=fooBar(40);
println!("b={:?},",b);

}